import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controller/getx_mixin_demo_controller.dart';

class GetxMixinDemoPage extends StatelessWidget {
  const GetxMixinDemoPage({super.key});

  @override
  Widget build(BuildContext context) {
    final GetxMixinDemoController controller =
        Get.put(GetxMixinDemoController());
    return Scaffold(
      appBar: AppBar(
        title: const Text('GetX Mixin 示例'),
        leading: IconButton(
          icon: const Icon(Icons.home),
          onPressed: () => Get.offAllNamed('/'),
        ),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Obx(() => Text(controller.lifecycle.value,
                style: const TextStyle(fontSize: 18))),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () => Get.offAllNamed('/'),
              child: const Text('返回首页'),
            ),
          ],
        ),
      ),
    );
  }
}
